home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Video.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  13.5 KB  |  358 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Video.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __VIDEO__
  18. #define __VIDEO__
  19.  
  20.  
  21. #ifndef __QUICKDRAW__
  22. #include <Quickdraw.h>
  23. #endif
  24. /*    #include <Types.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <MixedMode.h>                                        */
  27. /*    #include <QuickdrawText.h>                                    */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if GENERATINGPOWERPC
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37. #ifdef __CFM68K__
  38. #pragma lib_export on
  39. #endif
  40.  
  41.  
  42. enum {
  43.     mBaseOffset                    = 1,                            /*Id of mBaseOffset.*/
  44.     mRowBytes                    = 2,                            /*Video sResource parameter Id's */
  45.     mBounds                        = 3,                            /*Video sResource parameter Id's */
  46.     mVersion                    = 4,                            /*Video sResource parameter Id's */
  47.     mHRes                        = 5,                            /*Video sResource parameter Id's */
  48.     mVRes                        = 6,                            /*Video sResource parameter Id's */
  49.     mPixelType                    = 7,                            /*Video sResource parameter Id's */
  50.     mPixelSize                    = 8,                            /*Video sResource parameter Id's */
  51.     mCmpCount                    = 9,                            /*Video sResource parameter Id's */
  52.     mCmpSize                    = 10,                            /*Video sResource parameter Id's */
  53.     mPlaneBytes                    = 11,                            /*Video sResource parameter Id's */
  54.     mVertRefRate                = 14,                            /*Video sResource parameter Id's */
  55.     mVidParams                    = 1,                            /*Video parameter block id.*/
  56.     mTable                        = 2,                            /*Offset to the table.*/
  57.     mPageCnt                    = 3,                            /*Number of pages*/
  58.     mDevType                    = 4,                            /*Device Type*/
  59.     oneBitMode                    = 128,                            /*Id of OneBitMode Parameter list.*/
  60.     twoBitMode                    = 129,                            /*Id of TwoBitMode Parameter list.*/
  61.     fourBitMode                    = 130,                            /*Id of FourBitMode Parameter list.*/
  62.     eightBitMode                = 131                            /*Id of EightBitMode Parameter list.*/
  63. };
  64.  
  65. enum {
  66.     sixteenBitMode                = 132,                            /*Id of SixteenBitMode Parameter list.*/
  67.     thirtyTwoBitMode            = 133,                            /*Id of ThirtyTwoBitMode Parameter list.*/
  68.     firstVidMode                = 128,                            /*The new, better way to do the above. */
  69.     secondVidMode                = 129,                            /* QuickDraw only supports six video */
  70.     thirdVidMode                = 130,                            /* at this time.      */
  71.     fourthVidMode                = 131,
  72.     fifthVidMode                = 132,
  73.     sixthVidMode                = 133,
  74.     spGammaDir                    = 64,
  75.     spVidNamesDir                = 65
  76. };
  77.  
  78. /* csTimingFormat values in VDTimingInfo */
  79. /* look in the declaration rom for timing info */
  80. enum {
  81.     kDeclROMtables                = 'decl'
  82. };
  83.  
  84. /* csConnectFlags values in VDDisplayConnectInfo */
  85. enum {
  86.     kAllModesValid                = 0,                            /* All modes not trimmed by primary init are good close enough to try */
  87.     kAllModesSafe                = 1,                            /* All modes not trimmed by primary init are know to be safe */
  88.     kReportsTagging                = 2,                            /* Can detect tagged displays (to identify smart monitors) */
  89.     kHasDirectConnect            = 3,                            /* True implies that driver can talk directly to device (e.g. serial data link via sense lines) */
  90.     kIsMonoDev                    = 4,                            /* Says whether there’s an RGB (0) or Monochrome (1) connection. */
  91.     kUncertainConnection        = 5                                /* There may not be a display (no sense lines?). */
  92. };
  93.  
  94. /* csDisplayType values in VDDisplayConnectInfo */
  95. enum {
  96.     kUnknownConnect                = 1,                            /* Not sure how we’ll use this, but seems like a good idea. */
  97.     kPanelConnect                = 2,                            /* For use with fixed-in-place LCD panels. */
  98.     kPanelTFTConnect            = 2,                            /* Alias for kPanelConnect */
  99.     kFixedModeCRTConnect        = 3,                            /*  For use with fixed-mode (i.e., very limited range) displays. */
  100.     kMultiModeCRT1Connect        = 4,                            /* 320x200 maybe, 12" maybe, 13" (default), 16" certain, 19" maybe, 21" maybe */
  101.     kMultiModeCRT2Connect        = 5,                            /* 320x200 maybe, 12" maybe, 13" certain, 16" (default), 19" certain, 21" maybe */
  102.     kMultiModeCRT3Connect        = 6,                            /* 320x200 maybe, 12" maybe, 13" certain, 16" certain, 19" default, 21" certain */
  103.     kMultiModeCRT4Connect        = 7,                            /* Expansion to large multi mode (not yet used) */
  104.     kModelessConnect            = 8,                            /* Expansion to modeless model (not yet used) */
  105.     kFullPageConnect            = 9,                            /* 640x818 (to get 8bpp in 512K case) and 640x870 (these two only) */
  106.     kVGAConnect                    = 10,                            /* 640x480 VGA default -- question everything else */
  107.     kNTSCConnect                = 11,                            /* NTSC ST (default), FF, STconv, FFconv */
  108.     kPALConnect                    = 12,                            /* PAL ST (default), FF, STconv, FFconv */
  109.     kHRConnect                    = 13,                            /* 640x400 (to get 8bpp in 256K case) and 640x480 (these two only) */
  110.     kPanelFSTNConnect            = 14                            /* For use with fixed-in-place LCD FSTN (aka “Supertwist”) panels */
  111. };
  112.  
  113. /* csTimingFlags values in VDTimingInfoRec */
  114. enum {
  115.     kModeValid                    = 0,                            /* Says that this mode should NOT be trimmed. */
  116.     kModeSafe                    = 1,                            /* This mode does not need confirmation */
  117.     kModeDefault                = 2,                            /* This is the default mode for this type of connection */
  118.     kModeShowNow                = 3,                            /* This mode should always be shown (even though it may require a confirm) */
  119.     kModeNotResize                = 4                                /* This mode should not be used to resize the display (eg. mode selects a different connector on card) */
  120. };
  121.  
  122. enum {
  123. /* Control Codes */
  124.     cscReset                    = 0,
  125.     cscKillIO                    = 1,
  126.     cscSetMode                    = 2,
  127.     cscSetEntries                = 3,
  128.     cscSetGamma                    = 4,
  129.     cscGrayPage                    = 5,
  130.     cscGrayScreen                = 5,
  131.     cscSetGray                    = 6,
  132.     cscSetInterrupt                = 7,
  133.     cscDirectSetEntries            = 8,
  134.     cscSetDefaultMode            = 9,
  135.     cscSwitchMode                = 10,
  136.     cscSetSync                    = 11,
  137.     cscSetVideoConfiguration    = 22
  138. };
  139.  
  140. enum {
  141. /* Status Codes */
  142.     cscGetMode                    = 2,
  143.     cscGetEntries                = 3,
  144.     cscGetPageCnt                = 4,
  145.     cscGetPages                    = 4,                            /* This is what C&D 2 calls it. */
  146.     cscGetPageBase                = 5,
  147.     cscGetBaseAddr                = 5,                            /* This is what C&D 2 calls it. */
  148.     cscGetGray                    = 6,
  149.     cscGetInterrupt                = 7,
  150.     cscGetGamma                    = 8,
  151.     cscGetDefaultMode            = 9,
  152.     cscGetCurMode                = 10,
  153.     cscGetSync                    = 11,
  154.     cscGetConnection            = 12,                            /* Return information about the connection to the display */
  155.     cscGetModeTiming            = 13,                            /* Return timing info for a mode */
  156.     cscGetModeBaseAddress        = 14,                            /* Return base address information about a particular mode */
  157.     cscGetScanProc                = 15,                            /* QuickTime scan chasing routine */
  158.     cscGetNextResolution        = 20,
  159.     cscGetVideoParameters        = 21,
  160.     cscGetGammaList                = 22
  161. };
  162.  
  163. struct VPBlock {
  164.     long                            vpBaseOffset;                /*Offset to page zero of video RAM (From minorBaseOS).*/
  165.     short                            vpRowBytes;                    /*Width of each row of video memory.*/
  166.     Rect                            vpBounds;                    /*BoundsRect for the video display (gives dimensions).*/
  167.     short                            vpVersion;                    /*PixelMap version number.*/
  168.     short                            vpPackType;
  169.     long                            vpPackSize;
  170.     long                            vpHRes;                        /*Horizontal resolution of the device (pixels per inch).*/
  171.     long                            vpVRes;                        /*Vertical resolution of the device (pixels per inch).*/
  172.     short                            vpPixelType;                /*Defines the pixel type.*/
  173.     short                            vpPixelSize;                /*Number of bits in pixel.*/
  174.     short                            vpCmpCount;                    /*Number of components in pixel.*/
  175.     short                            vpCmpSize;                    /*Number of bits per component*/
  176.     long                            vpPlaneBytes;                /*Offset from one plane to the next.*/
  177. };
  178. typedef struct VPBlock VPBlock;
  179.  
  180. typedef VPBlock *VPBlockPtr;
  181.  
  182. struct VDEntryRecord {
  183.     Ptr                                csTable;                    /*(long) pointer to color table entry=value, r,g,b:INTEGER*/
  184. };
  185. typedef struct VDEntryRecord VDEntryRecord;
  186.  
  187. typedef VDEntryRecord *VDEntRecPtr;
  188.  
  189. /* Parm block for SetGray control call */
  190. struct VDGrayRecord {
  191.     Boolean                            csMode;                        /*Same as GDDevType value (0=mono, 1=color)*/
  192.     SInt8                            filler;
  193. };
  194. typedef struct VDGrayRecord VDGrayRecord;
  195.  
  196. typedef VDGrayRecord *VDGrayPtr;
  197.  
  198. /* Parm block for SetEntries control call */
  199. struct VDSetEntryRecord {
  200.     ColorSpec                        *csTable;                    /*Pointer to an array of color specs*/
  201.     short                            csStart;                    /*Which spec in array to start with, or -1*/
  202.     short                            csCount;                    /*Number of color spec entries to set*/
  203. };
  204. typedef struct VDSetEntryRecord VDSetEntryRecord;
  205.  
  206. typedef VDSetEntryRecord *VDSetEntryPtr;
  207.  
  208. /* Parm block for SetGamma control call */
  209. struct VDGammaRecord {
  210.     Ptr                                csGTable;                    /*pointer to gamma table*/
  211. };
  212. typedef struct VDGammaRecord VDGammaRecord;
  213.  
  214. typedef VDGammaRecord *VDGamRecPtr;
  215.  
  216. struct VDSwitchInfoRec {
  217.     unsigned short                    csMode;                        /*(word) mode depth*/
  218.     unsigned long                    csData;                        /*(long) functional sResource of mode*/
  219.     unsigned short                    csPage;                        /*(word) page to switch in*/
  220.     Ptr                                csBaseAddr;                    /*(long) base address of page (return value)*/
  221.     unsigned long                    csReserved;                    /*(long) Reserved (set to 0) */
  222. };
  223. typedef struct VDSwitchInfoRec VDSwitchInfoRec;
  224.  
  225. typedef VDSwitchInfoRec *VDSwitchInfoPtr;
  226.  
  227. struct VDTimingInfoRec {
  228.     unsigned long                    csTimingMode;                /* LONGINT - (long) timing mode (a la InitGDevice) */
  229.     unsigned long                    csTimingReserved;            /* LONGINT - (long) reserved */
  230.     unsigned long                    csTimingFormat;                /* LONGINT - (long) what format is the timing info */
  231.     unsigned long                    csTimingData;                /* LONGINT - (long) data supplied by driver */
  232.     unsigned long                    csTimingFlags;                /* LONGINT - (long) mode within device */
  233. };
  234. typedef struct VDTimingInfoRec VDTimingInfoRec;
  235.  
  236. typedef VDTimingInfoRec *VDTimingInfoPtr;
  237.  
  238. struct VDDisplayConnectInfoRec {
  239.     unsigned short                    csDisplayType;                /* INTEGER - (word) Type of display connected */
  240.     unsigned short                    csConnectTagged;            /* INTEGER - (word) Display is currently "it" (tagged to identify component) */
  241.     unsigned long                    csConnectFlags;                /* LONGINT - (long) tell us about the connection */
  242.     unsigned long                    csDisplayComponent;            /* LONGINT - (long) if the card has a direct connection to the display, it returns the display component here (FUTURE) */
  243.     unsigned long                    csConnectReserved;            /* LONGINT - (long) reserved */
  244. };
  245. typedef struct VDDisplayConnectInfoRec VDDisplayConnectInfoRec;
  246.  
  247. typedef VDDisplayConnectInfoRec *VDDisplayConnectInfoPtr;
  248.  
  249. struct VDPageInfo {
  250.     short                            csMode;                        /*(word) mode within device*/
  251.     long                            csData;                        /*(long) data supplied by driver*/
  252.     short                            csPage;                        /*(word) page to switch in*/
  253.     Ptr                                csBaseAddr;                    /*(long) base address of page*/
  254. };
  255. typedef struct VDPageInfo VDPageInfo;
  256.  
  257. typedef VDPageInfo *VDPgInfoPtr;
  258.  
  259. struct VDSizeInfo {
  260.     short                            csHSize;                    /*(word) desired/returned h size*/
  261.     short                            csHPos;                        /*(word) desired/returned h position*/
  262.     short                            csVSize;                    /*(word) desired/returned v size*/
  263.     short                            csVPos;                        /*(word) desired/returned v position*/
  264. };
  265. typedef struct VDSizeInfo VDSizeInfo;
  266.  
  267. typedef VDSizeInfo *VDSzInfoPtr;
  268.  
  269. struct VDSettings {
  270.     short                            csParamCnt;                    /*(word) number of params*/
  271.     short                            csBrightMax;                /*(word) max brightness*/
  272.     short                            csBrightDef;                /*(word) default brightness*/
  273.     short                            csBrightVal;                /*(word) current brightness*/
  274.     short                            csCntrstMax;                /*(word) max contrast*/
  275.     short                            csCntrstDef;                /*(word) default contrast*/
  276.     short                            csCntrstVal;                /*(word) current contrast*/
  277.     short                            csTintMax;                    /*(word) max tint*/
  278.     short                            csTintDef;                    /*(word) default tint*/
  279.     short                            csTintVal;                    /*(word) current tint*/
  280.     short                            csHueMax;                    /*(word) max hue*/
  281.     short                            csHueDef;                    /*(word) default hue*/
  282.     short                            csHueVal;                    /*(word) current hue*/
  283.     short                            csHorizDef;                    /*(word) default horizontal*/
  284.     short                            csHorizVal;                    /*(word) current horizontal*/
  285.     short                            csHorizMax;                    /*(word) max horizontal*/
  286.     short                            csVertDef;                    /*(word) default vertical*/
  287.     short                            csVertVal;                    /*(word) current vertical*/
  288.     short                            csVertMax;                    /*(word) max vertical*/
  289. };
  290. typedef struct VDSettings VDSettings;
  291.  
  292. typedef VDSettings *VDSettingsPtr;
  293.  
  294. typedef unsigned long DisplayModeID;
  295.  
  296. typedef unsigned long VideoDeviceType;
  297.  
  298. typedef unsigned long VideoMode;
  299.  
  300. typedef unsigned long GammaTableID;
  301.  
  302.  
  303. enum {
  304.     kFirstDepthMode                = 128,
  305.     kSecondDepthMode            = 129,
  306.     kThirdDepthMode                = 130,
  307.     kFourthDepthMode            = 131,
  308.     kFifthDepthMode                = 132,
  309.     kSixthDepthMode                = 133
  310. };
  311.  
  312. struct VDResolutionInfoRec {
  313.     DisplayModeID                    csPreviousDisplayModeID;    /* ID of the previous resolution in a chain */
  314.     DisplayModeID                    csDisplayModeID;            /* ID of the next resolution */
  315.     unsigned long                    csHorizontalPixels;            /* # of pixels in a horizontal line */
  316.     unsigned long                    csVerticalLines;            /* # of lines in a screen */
  317.     Fixed                            csRefreshRate;                /* Vertical Refresh Rate in Hz */
  318.     VideoMode                        csMaxDepthMode;                /* 0x80-based number representing max bit depth */
  319. };
  320. typedef struct VDResolutionInfoRec VDResolutionInfoRec;
  321.  
  322. typedef VDResolutionInfoRec *VDResolutionInfoPtr;
  323.  
  324. struct VDVideoParametersInfoRec {
  325.     DisplayModeID                    csDisplayModeID;            /* the ID of the resolution we want info on */
  326.     VideoMode                        csDepthMode;                /* The bit depth we want the info on (0x80 based) */
  327.     VPBlockPtr                        csVPBlockPtr;                /* Pointer to a vdeo parameter block */
  328.     unsigned long                    csPageCount;                /* Number of pages supported by the resolution */
  329.     VideoDeviceType                    csDeviceType;                /* Device Type:  Direct, Fixed or CLUT; */
  330. };
  331. typedef struct VDVideoParametersInfoRec VDVideoParametersInfoRec;
  332.  
  333. typedef VDVideoParametersInfoRec *VDVideoParametersInfoPtr;
  334.  
  335. struct VDGammaInfoRec {
  336.     GammaTableID                    csLastGammaID;                /* the ID of the previous gamma table */
  337.     GammaTableID                    csNextGammaID;                /* the ID of the next gamma table */
  338.     Ptr                                csGammaPtr;                    /* Ptr to a DeclROM style gamma table */
  339. };
  340. typedef struct VDGammaInfoRec VDGammaInfoRec;
  341.  
  342. typedef VDGammaInfoRec *VDGammaInfoPtr;
  343.  
  344.  
  345. #ifdef __CFM68K__
  346. #pragma lib_export off
  347. #endif
  348.  
  349. #if GENERATINGPOWERPC
  350. #pragma options align=reset
  351. #endif
  352.  
  353. #ifdef __cplusplus
  354. }
  355. #endif
  356.  
  357. #endif /* __VIDEO__ */
  358.